package _07_singleton_pattern.v2_0_thread_not_safe;

/**
 * @Description:
 * singleton == null 判断时,存在其他访问者得到了同样的判断结果
 * 使用时,再创建对象,俗称懒汉式
 * @Auther: 2019/6/11 14:44 by zhang.jy 
 */
public class Singleton {
     private static Singleton singleton = null; 
     //限制产生多个对象
     private Singleton(){
     }  
     //通过该方法获得实例对象
     public static Singleton getSingleton(){
             if(singleton == null){
                    singleton = new Singleton();
             }


             return singleton;
     }
}